import InteractiveBase from "../../../LevelCommon/InteractiveBase";
import FuseBox from "./FuseBox";
import LevelBaseControl from "../../../LevelCommon/LevelBaseControl";
import { GamePropData } from "../../../Data/GamePropData";

//保险丝
export default class Fuse extends InteractiveBase {
    /** 保险丝箱子*/
    private fuseBox: FuseBox;
    /** 需要的道具id*/
    public needPropId: number;
    protected InteractiveLogic(): boolean {
        let curLevelControl: LevelBaseControl = window.gameFacade.LevelMng.GetCurLevelControl();
        let curSelectProp: GamePropData = curLevelControl.CurSelectProp;
        /** 如果当前选中的是需要的道具 就使用*/
        if (curSelectProp != null && curSelectProp.id == this.needPropId) {
            /** 使用这个道具*/
            curLevelControl.UseCurProp();
            /** 保险丝箱 安装保险丝操作*/
            this.fuseBox.OnFuse();
        }
        return true;
    }
    public SetData(fuseBox: FuseBox) {
        this.fuseBox = fuseBox;
    }
}